package com.gongpingjialoan.widget.autoviewpagers;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Administrator on 2016/4/8.
 */
public abstract class DynamicPagerAdapter extends PagerAdapter {

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        return arg0==arg1;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((View) object);
    }

    @Override
    public int getItemPosition(Object object) {
        return super.getItemPosition(object);
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        View itemView = getView(container,position);
        container.addView(itemView);
        return itemView;
    }
    public abstract View getView(ViewGroup container, int position);

}